package com.bq.server.configuration;

import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 登录权限认证
 *
 * @author ChenSH
 */
public class PermissionInterceptor implements HandlerInterceptor {


    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

        if (!(handler instanceof HandlerMethod)) {
            return true;
        }
//        Class<?> beanType = ((HandlerMethod) handler).getBeanType();
//        LoginUserInfo loginUserInfo = SsoUtils.loginUserInfo();
//        if (loginUserInfo == null && !WebController.class.equals(beanType)) {
//            response.sendRedirect("login");
//            return false;
//        }
        return true;
    }


}
